package com.mall.b2c.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.mall.b2c.bean.OrderLogBean;
import com.mall.b2c.dao.OrderLogDao;
import com.mall.b2c.domain.order.OrderLogDomain;
import com.mall.b2c.service.OrderLogService;
import com.mall.common.hibernate.Finder;
import com.mall.common.service.impl.BaseServiceImpl;


/**
 * Service实现类 - 订单日志
 * @author 
 */
@Service("b2cOrderLogService")
@Transactional(readOnly=true)
public class OrderLogServiceImpl extends BaseServiceImpl<OrderLogDomain, Long> implements OrderLogService {
	
	@Resource
	public void setBaseDao(OrderLogDao orderLogDao) { 
		super.setBaseDao(orderLogDao); 
	}

	@Override
	public List<OrderLogBean> findLogsByMemberId(String orderNo, Long memberId) {
		String hql = "select new com.mall.b2c.bean.OrderLogBean(ol) from OrderLogDomain ol where ol.order.orderNo = :orderNo and ol.order.member.id = :memberId"
					+" order by ol.createDate desc";
		Finder finder = Finder.create(hql);
		finder.setParam("orderNo", orderNo);
		finder.setParam("memberId", memberId);
		return finder.findHQLList();
	}

}
